//
//  UIColor+DarkAndLightColor.m
//  暗黑模式适配
//
//  Created by Jason on 2022/6/24.
//

#import "UIColor+DarkAndLightColor.h"

@implementation UIColor (DarkAndLightColor)

+ (UIColor *)colorWithLight:(UIColor *)lightColor dark:(UIColor *)darkColor {
    if (@available( iOS 13.0, *)) {
        return [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull traitCollection) {
            if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
                return darkColor;
            } else {
                return lightColor;
            }
        }];
    } else {
        return lightColor;
    }
}

@end
